{{include file="header.tpl"}}
<div class="login_inter">
	<div class="w1002 login_mid">
    	<div class="login_con">
        	<i></i>
            <div class="reg_steps">
                <form action="index.php?{{$TIN_CTL}}=user&{{$TIN_ACT}}=Reg2" method="post" id="signup-user-form">
                    手机:{{$user_data.USERNAME}}
                    <input type="button" id="GetVerify" value="发送验证码" onclick="get_verify()" /><br />
                    <input type="text" name="id_code" id="id_code" /><br />
                    <input type="submit" id="dosubmit" /><br />
    			</form>
            </div>
        </div>
	</div>
</div>
<script type="text/javascript" src="res/js/formvalidator/formValidator-4.1.3.js"></script>
<script type="text/javascript">
                var times = 30;
                var isinerval;
                function CountDown() {
                    if (times < 1) {
                        $("#GetVerify").val("获取短信验证码").attr("disabled", false);
                        clearInterval(isinerval);
                        return;
                    }
                    $("#GetVerify").val(times+"秒后重获验证码");
                    times--;
                }
                function get_verify() {
                    $.get("index.php?ctl=user&act=sms",{ /*mobile: mobile,*/random:Math.random()}, function(data){
                        if(data=="0") {
                           times = 30;
                            $("#GetVerify").attr("disabled", true);
                            isinerval = setInterval("CountDown()", 1000);
                        } else if(data=="-1") {
                            alert("你今天获取验证码次数已达到上限");
                        } else {
                            alert("短信发送失败");
                        }
                    });
                    
                }
$(document).ready(function(){
    $.formValidator.initConfig({theme:"126",formID:"signup-user-form",mode:'AutoTip',onError:function(msg){alert(msg)},inIframe:true});

                $("#id_code").formValidator({onshow:"请输入手机收到的验证码",onfocus:"请输入手机收到的验证码"}).inputValidator({min:1,onerror:"请输入手机收到的验证码"}).ajaxValidator({
                    type : "get",
                    url : "index.php",
                    data :"ctl=user&act=smsverify",
                    datatype : "html",
                    success : function(data){
                        if( data == "1" ) {
                            return true;
                        } else {
                            return false;
                        }
                    },
                    buttons: $("#dosubmit"),
                    onerror : "验证码错误",
                    onwait : "请稍候..."
                });
      });

</script>

{{include file="footer.tpl"}}